//
//  GoodsDetailModel.m
//  StandardizedProduct
//
//  Created by 宁宁 on 16/8/12.
//  Copyright © 2016年 ym. All rights reserved.
//

#import "GoodsDetailModel.h"

@implementation GoodsDetailModel

+ (GoodsDetailModel *)parseUserWithDictionary:(NSDictionary *)dict{
    GoodsDetailModel *model = [[GoodsDetailModel alloc] init];
    
    /**商品编号*/
    model.ProductCode = [NSString stringWithFormat:@"%@", dict[@"ProductCode"]];
    
    /**品牌编号*/
    model.BrandId = [NSString stringWithFormat:@"%@", dict[@"BrandId"]];
    /**属性1*/
    model.Propertyname = [NSString stringWithFormat:@"%@\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%@\n%@", dict[@"Property1name"], dict[@"Property2name"], dict[@"Property3name"], dict[@"Property4name"], dict[@"Property5name"], dict[@"Property6name"], dict[@"Property7name"], dict[@"Property8name"], dict[@"Property9name"], dict[@"Property10name"]];
    /**标题*/
    model.Title = [NSString stringWithFormat:@"%@", dict[@"Title"]];
    /**价格*/
    model.Price = [NSString stringWithFormat:@"%@", dict[@"Price"]];
    /**创建时间*/
    model.CreationDate = [NSString stringWithFormat:@"%@", dict[@"CreationDate"]];
    /**商品状态*/
    model.ProductStatus = [NSString stringWithFormat:@"%@", dict[@"ProductStatus"]];
    /**描述*/
//    NSMutableString *String = [NSMutableString stringWithFormat:@"%@", dict[@"Descriptions"]];
//    model.Descriptions = [NSString stringWithFormat:@"%@", [String componentsSeparatedByString:@"\\"][1]];
    /**更新时间*/
    model.UpDate = [NSString stringWithFormat:@"%@", dict[@"UpDate"]];
    /**缩略图*/
    model.ProductSmallUrl = [NSString stringWithFormat:@"%@%@", BaseURLStringString,dict[@"ProductSmallUrl"]];
    /**是否积分商品*/
    model.IsJiFenProduct = [NSString stringWithFormat:@"%@", dict[@"IsJiFenProduct"]];
    /**市场价*/
    model.MarketPrice = [NSString stringWithFormat:@"%@", dict[@"MarketPrice"]];
    /**介绍*/
    model.PropGroup = [NSString stringWithFormat:@"%@", dict[@"PropGroup"]];
    /**分类*/
    model.ProductCats = [NSString stringWithFormat:@"%@", dict[@"ProductCats"]];
    /**品牌名*/
    model.BrandName = [NSString stringWithFormat:@"%@", dict[@"BrandName"]];
    /**图文详情图片数组*/
    model.ImageUrlArray = [NSMutableArray array];
    for (NSDictionary *dic in dict[@"ProductImageModellist"]) {
        [model.ImageUrlArray addObject:[NSString stringWithFormat:@"%@%@", BaseURLStringString, dic[@"ImageUrl"]]];
    }
    /**判断有无库存*/
    model.SkuExtendModellist = [NSString stringWithFormat:@"%@", dict[@"SkuExtendModellist"]];
    if ([dict[@"SkuExtendModellist"] count] > 0) {
        model.SKUArray = [NSMutableArray array];
        model.NormsDetailNamesArray = [NSMutableArray array];
        model.QtyArray = [NSMutableArray array];
        model.SkuIdArray = [NSMutableArray array];
        model.PictureUrlArray = [NSMutableArray array];
        for (int i = 0; i < [dict[@"SkuExtendModellist"] count]; i++) {
            NSDictionary *dic = dict[@"SkuExtendModellist"][i];
            /**商品条码*/
            [model.SKUArray addObject:[NSString stringWithFormat:@"%@", dic[@"SKU"]]];
            [model.NormsDetailNamesArray addObject:[NSString stringWithFormat:@"%@", dic[@"NormsDetailNames"]]];
            [model.QtyArray addObject:[NSString stringWithFormat:@"%@", dic[@"Qty"]]];
            [model.SkuIdArray addObject:[NSString stringWithFormat:@"%@", dic[@"IESSkuId"]]];
            [model.PictureUrlArray addObject:[NSString stringWithFormat:@"%@%@", BaseURLStringString, dic[@"PictureUrl"]]];
        }
    }
    
    return model;
}


@end
